for i in range(1,10):#输入9行，正序
	for j in range(1,i+1):
		a = i * j
		print ("{}*{}={:<4}".format(j ,i ,a),end="")
	print ("")#换行

print ("="*80)


for m in range(9,0,-1):#输入9行，倒序
	for n in range(1,m+1):
		b = m * n
		print ("{}*{}={:<4}".format(n ,m ,b),end="")
	print ("")#换行


